#ifndef PROJECTION_HPP
#define PROJECTION_HPP

//-----------------------------------------------------------------------------
// Includes
//-----------------------------------------------------------------------------
#include <Math/Matrix.hpp>

namespace Rendering {

	//-------------------------------------------------------------------------
	class IPointOfView {
		public:	
			// Constructor
			IPointOfView();
			IPointOfView(float fov, float near, float far);
			// Desttructor
			virtual ~IPointOfView();	
			// Get field of view
			inline float GetFieldOfView() const;
			// Get view range
			inline void GetRangeOfView(float &near, float& far) const;
			// Get Projection matrix
			inline Matrix::Matrix4& GetProjectionMatrix();
			// Get view matrix
			inline Matrix::Matrix4& GetViewMatrix();	
		protected:
			// Update matrix by derived class
			virtual void UpdateProjectionMatrix()=0;
			virtual void UpdateViewMatrix()=0;
			// Attributes
			float fieldOfView, nearPlane, farPlane;
			// Point of view matrix
			Matrix::Matrix4 projectionMatrix;
			Matrix::Matrix4 viewMatrix;
	};

	//-------------------------------------------------------------------------
	inline float IPointOfView::GetFieldOfView() const {
		return fieldOfView;
	}
	//-------------------------------------------------------------------------
	inline void IPointOfView::GetRangeOfView(float &n, float& f) const {
		n = nearPlane;
		f  = farPlane;
	}
	//-------------------------------------------------------------------------	
	inline Matrix::Matrix4& IPointOfView::GetProjectionMatrix() {
		UpdateProjectionMatrix();
		return projectionMatrix;
	}
	//-------------------------------------------------------------------------
	inline Matrix::Matrix4& IPointOfView::GetViewMatrix() {
		UpdateViewMatrix();
		return viewMatrix;
	}
	//-------------------------------------------------------------------------
}
#endif //PROJECTION_HPP
